home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / corplot.c < prev    next >
C/C++ Source or Header  |  1993-05-24  |  3KB  |  97 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: corplot.c,v 3.37 1992/05/28 03:31:19 woo Exp $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - corplot.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * There is a mailing list for gnuplot users. Note, however, that the
  35.  * newsgroup 
  36.  *    comp.graphics.gnuplot 
  37.  * is identical to the mailing list (they
  38.  * both carry the same set of messages). We prefer that you read the
  39.  * messages through that newsgroup, to subscribing to the mailing list.
  40.  * (If you can read that newsgroup, and are already on the mailing list,
  41.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  42.  * removed from the mailing list.)
  43.  *
  44.  * The address for mailing to list members is
  45.  *       info-gnuplot@dartmouth.edu
  46.  * and for mailing administrative requests is 
  47.  *       info-gnuplot-request@dartmouth.edu
  48.  * The mailing list for bug reports is 
  49.  *       bug-gnuplot@dartmouth.edu
  50.  * The list of those interested in beta-test versions is
  51.  *       info-gnuplot-beta@dartmouth.edu
  52.  */
  53. #include <stdio.h>
  54. #include <process.h>
  55. #include <dos.h>
  56. #if defined(ATARI) && defined(__PUREC__)
  57. #include <plot.h>
  58. #endif
  59.  
  60. #define BOUNDARY 32768
  61. #define segment(addr) (FP_SEG(m) + ((FP_OFF(m)+15) >> 4));
  62. #define round(value,boundary) (((value) + (boundary) - 1) & ~((boundary) - 1))
  63.  
  64. char *malloc(),*realloc();
  65.  
  66. char prog[] = "gnuplot";
  67. char corscreen[] = "CORSCREEN=0";
  68.  
  69. main()
  70. {
  71. register unsigned int segm,start;
  72. char *m;
  73.     if (!(m = malloc(BOUNDARY))) {
  74.         printf("malloc() failed\n");
  75.         exit(1);
  76.     }
  77.     segm = segment(m);
  78.     start = round(segm,BOUNDARY/16);
  79.  
  80.     if (realloc(m,BOUNDARY+(start-segm)*16) != m) {
  81.         printf("can't realloc() memory\n");
  82.         exit(2);
  83.     }
  84.  
  85.     if ((segm = start >> 11) >= 8) {
  86.         printf("not enough room in first 256K\n");
  87.         exit(3);
  88.     }
  89.  
  90.     corscreen[sizeof(corscreen)-2] = '0' + segm;
  91.     if (putenv(corscreen))
  92.         perror("putenv");
  93.  
  94.     if (spawnlp(P_WAIT,prog,prog,NULL))
  95.         perror("spawnlp");
  96. }
  97.